package code.example.temp;

public class TestBaoXian {
    public static void main(String [] args){
        int baseMoney=8000;
        int sumMoney = 0;
        double lixiMoney=0;
        double lixiMoneyThisYear=0;
        System.out.println("每年交8000,累计交20年,按理财利率5计算（1万元一年利息500）:");
        for(int i=0;i<20;i++){
            sumMoney +=baseMoney;
            lixiMoneyThisYear = sumMoney * 0.05;
            lixiMoney+=lixiMoneyThisYear;
            System.out.println("第"+(i+1)+"年"+(i<9?" ":"")+" : 已交保费:"+sumMoney+",当年利息:"+lixiMoneyThisYear);
        }
        System.out.println("总保费:"+sumMoney);
        System.out.println("合计利息:"+lixiMoney);
        System.out.println("总合计:"+(sumMoney +lixiMoney));
    }
}
